record VURL key hashes in addcomputed and recompute
authorJoey Hess <joeyh@joeyh.name>
Mon, 3 Mar 2025 14:57:56 +0000 (10:57 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 3 Mar 2025 14:57:56 +0000 (10:57 -0400)
Command/AddComputed.hs
Logs/EquivilantKeys.hs
Remote/Compute.hs
TODO-compute

index 20eacf954fb3dbe3d73e39f565c9f13c5df767c7..857e495ad02ea0d72af29deeef1ab33d1773303c 100644 (file)
@@ -19,8 +19,10 @@ import Annex.CatFile
 import Annex.Content.Presence
 import Annex.Ingest
 import Types.KeySource
+import Types.Key
 import Messages.Progress
 import Logs.Location
+import Logs.EquivilantKeys
 import Utility.Metered
 import Backend.URL (fromUrl)
 
@@ -174,6 +176,10 @@ addComputed addaction stagefiles r reproducibleconfig choosebackend destfile fas
                        Nothing -> giveup "ingestion failed"
                        Just k -> do
                                logStatus NoLiveUpdate k InfoPresent
+                               when (fromKey keyVariety k == VURLKey) $ do
+                                       hb <- hashBackend
+                                       void $ addEquivilantKey hb k 
+                                               =<< calcRepo (gitAnnexLocation k)
                                return k
        
        ldc = LockDownConfig
index 32accda7770ffff20fdf2490077c4cebee7d17d3..b2386757240d360f0f83b9dff79900cb70992233 100644 (file)
@@ -11,6 +11,7 @@ module Logs.EquivilantKeys (
        getEquivilantKeys,
        setEquivilantKey,
        updateEquivilantKeys,
+       addEquivilantKey,
        generateEquivilantKey,
 ) where
 
@@ -37,8 +38,6 @@ setEquivilantKey key equivkey = do
        addLog (Annex.Branch.RegardingUUID []) (equivilantKeysLogFile config key)
                InfoPresent (LogInfo (serializeKey' equivkey))
 
--- The Backend must use a cryptographically secure hash.
---
 -- This returns Verified when when an equivilant key has been added to the
 -- log (or was already in the log). This is to avoid hashing the object
 -- again later.
@@ -50,6 +49,12 @@ updateEquivilantKeys b obj key eks = generateEquivilantKey b obj >>= \case
                        setEquivilantKey key ek
                return (Just Verified)
 
+addEquivilantKey :: Backend -> Key -> OsPath -> Annex (Maybe Verification)
+addEquivilantKey b key obj = 
+       updateEquivilantKeys b obj key
+               =<< getEquivilantKeys key
+
+-- The Backend must use a cryptographically secure hash.
 generateEquivilantKey :: Backend -> OsPath -> Annex (Maybe Key)
 generateEquivilantKey b obj =
        case genKey b of
index 84170fc5dda523d5ccfa2d834ba996f68e9d4e4f..eaef6d44fb96094f28a81237b71af25dd5c1003a 100644 (file)
@@ -482,10 +482,7 @@ computeKey rs (ComputeProgram program) k _af dest p vc =
                hb <- hashBackend
                let updatevurl key getobj = 
                        if (fromKey keyVariety key == VURLKey)
-                               then do
-                                       obj <- getobj
-                                       updateEquivilantKeys hb obj key
-                                               =<< getEquivilantKeys key
+                               then addEquivilantKey hb key =<< getobj
                                else return Nothing
 
                let keyfile' = tmpdir </> keyfile
index 1f3ac6c9d538f800d94c3c18e4f28c00bc5f4a0d..dfa629ab8b2da0d9f40fed50cb77a24538009f1e 100644 (file)
@@ -1,6 +1,3 @@
-* VURL keys don't currently have the hash key recorded in the equivilant
-  key log by addcompute
-
 * need progress bars for computations and implement PROGRESS message
 
 * get input files for a computation (so `git-annex get .` gets every file,